December 1995

Configuring printers with the LP print service on your Solaris 2.x system

One of the most time-consuming jobs for a Solaris 2.x system administrator is managing printers. Not only do you have to decide who can access which printers, but you also have to configure and troubleshoot the printers.

With the introduction of Solaris 2.x, many system administrators found that migrating from SunOS 4.x meant a big change for printing administration. To begin with, printer descriptions were no longer included in the /etc/printcap files. In addition, many aspects of the new LP print service were different than the print services associated with SunOS 4.x and earlier.

In this article, we'll discuss the Solaris 2.x LP print service and show you which daemons, files, and logs the print service uses. We'll show you how to add and remove printers from your network and demonstrate how to configure printer definitions.

Getting started

Before we begin looking at the LP print service, it's important to understand all of the tasks that the service performs. These tasks include:

The LP print service accomplishes these tasks through a single administration LP scheduler daemon called lpsched. This daemon schedules all local print requests and updates the LP system files with information about printer set-up and configuration. The LP print service commands, located in the /usr/bin directory and shown in Table A, send requests to the lpsched daemon, which in turn interprets the LP system files, located in the /etc/lp directory and shown in Table B, for handling the print requests.

TABLE A

LP Command/Definition

accept/reject Accepts or rejects printer requests for specified destinations

enable/disable Enables or disables specified printers

lpadmin Configures the LP print service by defining printers and devices

lpfilter Adds, changes, deletes and lists filters used with the LP print service

lpforms Administers the use of preprinted forms with the LP print service

lpmove Moves print requests from one destination to another

lpshut Stops the LP print service

lpsystem Registers remote systems with the LP print service

lpusers Sets printing queue priorities

These LP commands send requests to the lpsched daemon.

TABLE B

LP system files (/etc/lp) Contents

systems LP spooler system information

classes User-defined printer classes

fd Printer filters

forms user-defined forms

interfaces Printer interfaces

logs LP print service logs (linked to /var/lp)

model Printer interfaces for specific types of printers (linked to /usr/lib/lp)

printers Printer definitions

pwheels Printwheel definitions

These LP system files are used by lpsched to clarify information from a print request before printing.

Using lpadmin to define printers

If you use OpenWindows on a Solaris 2.x system, you're probably familiar with adding printers via the admintool utility. When you use the Print Manager associated with admintool to create a new printer, you also create a port monitor for the device associated with the printer.

Although admintool provides the interface for adding printers, you can also define new printers by using the lpadmin utility. However, you'll need to manually create a port monitor for each new printer as well. When configuring new printers for your systems, make sure that you're logged in as the superuser root. First, let's take a look at adding a printer with lpadmin.

To create a new printer from the command prompt enter a command in the form

# lpadmin -p printername options

The options portion of the command must include several items to define the printer. First, you must include one of three options for determining what the printer connects to on your system. These three options are

-v device

-s system_name! printer_name

-U dial-up info

The -v option tells the LP print service that the new printer connects locally to the specified device. Make sure you include the complete path of the device where the printer connects to your system in the form /device-path/device-name.

The -s option tells the LP print service that the new printer is connected remotely to another system on your network. The system_name must be listed in the systems table located in the /etc/lp/Systems file. The printer_name must be the same name as the name of the printer connected to the remote system. So for example, if you'd like to create a new printer named printA on your system and the printer you want to connect to is named printB , and it's connected to a system named widget2, your command line would look like this:

# lpadmin -p printA -s widget2!printB

The -U option tells the LP print service that the new printer is connected remotely through a dial-up device, such as a modem. By default, the dial-up info string uses a direct connection through connections other than the dial-up routine, such as TCP/IP.

Other lpadmin options

In addition to determining which device a new printer connects to, you can use many other options for configuring specific information about your new printer. Let's take a look at some of lpadmin's other options for configuring your new printer.

You can use the -A option to specify the type of alert you want the LP print service to send when it detects a printing error on the new printer. By default, the LP print service sends mail to the system administrator for each fault detected.

If you'd like to give information to your users about a new printer, you can use the -D option to add a comment to the printer. When users issue an lpstat command to obtain status information on the new printer, they'll also see any comments included during the configuration using the -D option.

If you've defined form descriptions for your printers, you can configure your new printer to accept or deny certain forms by using the -f deny/allow option. By default, no forms are allowed on a new printer. To create new forms for a printer, you must first use the lpforms utility and then enable the new forms for printing on a new printer by using the lpadmin option -f allow:form-list.

When you assign certain users to a printer on your system, the lpadmin option -u allow:login-ID-list allows only the users you specify to utilize the printer. By default, all users are allowed to use a new printer. However, with larger systems, it's often necessary to allow only certain users access to a printer. The login ID list argument can use any or all of the constructs shown in Table C.

TABLE C

Login ID/Definition

login-ID A user on any system

systemname!login-ID A user on system systemname

systemname!all All users on system systemname

all!login-ID A user on all systems

all All users on all systems

Create a login-ID list file using this syntax to allow only certain users access to a printer.

Other options commonly-used with the lpadmin utility include:

-c class-Inserts printer into the specified class. Class will be created if it doesn't exist.

-e printername-Copies the interface program of the printer name specified as the interface for the new printers.

-i interface-Establishes a new interface program for the printer; you should include the complete path of the interface program

-m model-Selects the model interface program for the printer provided by the LP print service

-r class-Removes the printer from the specified class and removes the class if the printer is the last one in that class.

You can also enable or disable banner pages with lpadmin. For more information on how to disable or enable banner pages for your printers, see the sidebar "Turning banner pages on and off."

Creating a port monitor

A port monitor is a program that continuously watches for requests to log in or requests to access printers or files. The SunOS 5.x system provides two types of port monitors: listen and ttymon. The listen port monitor controls access to network services, fielding remote print and file system requests.

If you use admintool to create your printers, you create a listen port monitor at the same time you create a new printer. However, if you don't use admintool to create your new printer, you can manually add a port monitor.

To add a port monitor for your new printer, log in into your system as the superuser root. At a command prompt, enter the command

# sacadm -a -p tcp -t listen -c "/usr/lib/saf/listen tcp" -v 'nlsadmin -V' -n 9999

and press [Enter]. This creates a listen port monitor using the Service Access Controller program sacadm.

Next, you'll need to verify that the network listen status is enabled. At the command prompt enter the command

# sacadm -l

You should see output like that shown in Figure A. Be aware that it may take several minutes before the network listen service is enabled.

Configuring your port monitor as a print server

If you want to configure your system as a print server, the next step is to register the listen service on your network. In order to register the listen service, you'll need to know your system's universal address. To get this information, enter the command

# lpsystem -A

You'll then see a line of digits and characters displayed. The first four digits identify the Internet family. The fifth through eighth digits identify the TCP port. To register the new listen port monitor, you'll modify the fifth through eighth digits to read 0ACE (the first character is zero).

To register listen service 0 on your network, type the command

pmadm -a -p tcp -s 0 -i root -m `nlsadmin -c /usr/lib/saf/nlps_server -A '\xmodified_universal_address'` -v `nlsadmin -V`

and press [Enter]. Make sure that the modified address is enclosed in single quotation marks and not back tics so that the backslash isn't stripped off. Once you've registered the listen service with your network, you can further specify which clients the server will accept print requests from.

To configure the print server to accept requests from SunOS 5.x clients, enter the command

pmadm -a -p tcp -s lp -i root -m `nlsadmin -o /var/spool/lp/fifos/listenS5` -v `nlsadmin -V`

This configures the port monitor to listen to requests from listenS5, which registers print requests from SunOS 5.x print clients.

To configure the print server to receive requests from SunOS 4.x print clients, enter the command

pmadm -a -p tcp -s lpd -i root -m `nlsadmin -o /var/spool/lp/fifos/listenBSD -A '\x universal_address'` -v `nlsadmin -V`

This configures the port monitor to listen for requests from listenBSD, which registers requests from SunOS 4.x print clients.

Conclusion

When configuring printers on your Solaris 2.x system, you'll probably use the admintool utility available in OpenWindows. This creates all the background information for printer configuration without any user knowledge. By using the LP print service to configure a printer for your Solaris 2.x system, you can get a better understanding of the complexities of how Solaris handles printing behind the scenes. In this article, we've discussed the LP print service and its associated utilities.


[Return to Index for Inside Solaris - December Issue]

Copyright (c) 1995 The Cobb Group, a division of Ziff-Davis Publishing Company. All rights reserved.

Reproduction in whole or in part in any form or medium without express written permission of Ziff-Davis

Publishing Company is prohibited. The Cobb Group and The Cobb Group logo are trademarks of

Ziff-Davis Publishing Company.

Inside Solaris is a publication of The Cobb Group.
1-800-223-8720